package com.gwt.tirso.gymkhana.server;
/*
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import com.gwt.tirso.gymkhana.client.Gymkhana;
import com.gwt.tirso.gymkhana.client.Question;

public class JDBCQuestReferencesDAO implements IQuestReferencesDAO {
	
	private Connection c;
	
	public JDBCQuestReferencesDAO() {
	       c = ConnectionManager.getInstance().checkOut();
	}
	
	protected void finalize() {
	       ConnectionManager.getInstance().checkIn(c);
	}

	@Override
	public void insertQuestionReference(Gymkhana g, Question q) {

		PreparedStatement stmt = null;
		String sql = "INSERT INTO GymQuestRelation ( idgymkhana, idquestion) VALUES (?, ?)";
        try {
        	stmt = c.prepareStatement(sql);
            stmt.setString(1, g.getId());
            //stmt.setString(2, q.getId());
            
            stmt.executeUpdate();

	        } catch (Exception e) {
	            System.out.println("Message: insertQuestReference: " + e.getMessage());
	            System.out.println("SQLState: " + ((SQLException) e).getSQLState());
	            System.out.println("ErrorCode: " + ((SQLException) e).getErrorCode());
	        } finally {
            try {
                if (stmt != null) {
                    stmt.close();
                }
            } catch (SQLException e) {
            }
	    }
		
	}

	@Override
	public List<String> selectGymkhanaQuestions(Gymkhana g) {
		Connection conn = ConnectionManager.getInstance().checkOut();

		PreparedStatement stmt = null;
		List<String> questionsID = new ArrayList<String>();
		ResultSet result = null;

		try {

			String sql = "SELECT * FROM GymQuestRelation WHERE idgymkhana = ?";
			stmt = conn.prepareStatement(sql);
			stmt.setString(1, g.getId());

			stmt.executeQuery();
			result = stmt.executeQuery();

			while(result.next()){
				String s = new String();
				s = result.getString("idquestion");
				questionsID.add(s);
			}
			

		} catch (SQLException e) {
			System.out.println("Message: selectGymkhanaByNameAndPass: "
					+ e.getMessage());
			System.out.println("SQLState: " + e.getSQLState());
			System.out.println("ErrorCode: " + e.getErrorCode());
		} finally {
			ConnectionManager.getInstance().checkIn(conn);
			try {
				if (result != null)
					result.close();
				if (stmt != null)
					stmt.close();
			} catch (SQLException e) {
			}

		}
		return questionsID;
	}
	
	

}*/
